<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>简单登录注册示例</title>
    <style>
        body { font-family: Arial, Helvetica, sans-serif; max-width: 720px; margin: 2rem auto; }
        nav a { margin-right: 1rem }
        .msg { color: red }
    </style>
</head>
<body>
    <nav>
        <a href="{% url 'accounts:home' %}">首页</a>
        {% if user.is_authenticated %}
            <span>欢迎，{{ user.username }}</span>
            <a href="{% url 'accounts:logout' %}">登出</a>
        {% else %}
            <a href="{% url 'accounts:login' %}">登录</a>
            <a href="{% url 'accounts:register' %}">注册</a>
        {% endif %}
    </nav>

    {% if messages %}
        <ul class="msg">
            {% for message in messages %}
                <li>{{ message }}</li>
            {% endfor %}
        </ul>
    {% endif %}

    <hr>
    {% block content %}{% endblock %}
</body>
</html>
